<template>
    <div>
        <van-button @click="changeProducts(item.name)" class="m-btn" v-for="item in childCategory" :key="item.id" round
                    type="info">{{item.name}}
        </van-button>
    </div>
</template>

<script>
    import {getProductList} from "../../../utils/apis";

    export default {
        name: "ChildCategory",
        props: ['childCategory'],
        data() {
            return {}
        },
        methods: {
            changeProducts(key) {
                getProductList({keyword: key}).then(res => {
                    this.$emit('handleChange', res.data.list, true)
                })
            }
        }
    }
</script>

<style scoped>
    .m-btn {
        margin: 20px 12px;
    }
</style>
